package com.sql.test;
import com.mysql.cj.jdbc.Driver;

import java.sql.*;
import java.util.Properties;

//@SuppressWarnings({"all"})

public class jdbc01 {
    public static void main(String[] args) throws SQLException {
        Driver driver = new Driver();


        String url = "jdbc:mysql://localhost:3306/ztm";
//        String user = "your_username";
//        String password = "your_password";
//        Connection connection = DriverManager.getConnection(url, user, password);
//        String url = "jdbc:mysql://localhost:3306/ztm?useSSL=false";

        Properties properties = new Properties();
        properties.setProperty("user", "root");
        properties.setProperty("password", "123456789");
        Connection connect = driver.connect(url, properties);

//        String sql = "insert into ztm.student values(20,'小白','123','女','2025-04-01','chINA','on1676')";
//        Statement statement = connect.createStatement();
//        int rows = statement.executeUpdate(sql);
//        System.out.println(rows > 0 ? "成功":"失败");
//
//        statement.close();
        System.out.println(connect);
        connect.close();

    }
}
